package com.bianpai.core;

/**
 * 节点抽象实现，提供基本功能
 */
public abstract class AbstractNode implements Node {
    private String id;
    private String name;
    private String description;
    private boolean rollbackable;
    
    public AbstractNode(String id, String name) {
        this.id = id;
        this.name = name;
        this.rollbackable = true; // 默认可回滚
    }
    
    @Override
    public String getId() {
        return id;
    }
    
    @Override
    public String getName() {
        return name;
    }
    
    @Override
    public String getDescription() {
        return description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }
    
    @Override
    public boolean isRollbackable() {
        return rollbackable;
    }
    
    public void setRollbackable(boolean rollbackable) {
        this.rollbackable = rollbackable;
    }
    
    /**
     * 默认的回滚实现，子类可以覆盖
     */
    @Override
    public boolean rollback(FlowContext context) {
        // 默认实现，子类应该覆盖此方法提供实际的回滚逻辑
        return true;
    }
}